package com.nbsaas.boot.finance.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "会计科目", model = "会计科目")
@Entity
@Table(name = "bs_account_subject")
@Comment("会计科目表")
public class AccountSubject extends AbstractEntity {

    @Comment("科目编码")
    @SearchItem(name = "code", key = "code", label = "科目编码")
    @FormField(title = "科目编码", sortNum = "1", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String code;

    @Comment("科目名称")
    @SearchItem(name = "name", key = "name", label = "科目名称")
    @FormField(title = "科目名称", sortNum = "2", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("科目级次")
    @FormField(title = "科目级次", sortNum = "3", grid = true)
    private Integer level;

    @Comment("上级科目")
    @FormField(title = "上级科目", sortNum = "4", grid = true)
    private Long parentId;

    @Comment("是否末级")
    @FormField(title = "是否末级", sortNum = "5", grid = true, type = InputType.select)
    private Boolean isLeaf;

    @Comment("科目类型")
    @FormField(title = "科目类型", sortNum = "6", grid = true, type = InputType.select)
    @Column(length = 20)
    private String type;

    @Comment("是否启用")
    @FormField(title = "是否启用", sortNum = "7", grid = true, type = InputType.select)
    private Boolean enabled;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "8", type = InputType.textarea)
    private String remark;
} 